package com.hulang.sms.sending.config;

import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@MapperScan("com.hulang.sms.sending.mapper")
public class MyBatisPlusConfig {
    public static final int DEFAULT_PAGE_SIZE = 8;

    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }

    /**
     * 获取一个通用的分页构造器
     *
     * @param current
     * @return
     */
    public static Page pageInstance(int current) {
        Page page = new Page(current, DEFAULT_PAGE_SIZE);
        return page;
    }
}
